% each aaiOutput matrix is a matrix 'N x 2', where each row is an opening/closing pair
% (the numbers refer to the times when the raw events occurred)
%
function [	aaiDoorOpeningClosingTransitions,				...
	   		aaiLaser1OpeningClosingTransitions,				...
	   		aaiLaser2OpeningClosingTransitions	] =			...
	   			FindOpeningClosingTransitions( aafRawData )
	%
	% load the labels of the raw data events
	tLabels = PeopleCounters.LoadRawEventsLabels();
	%
	if( PeopleCounters.AreRawDataValid( aafRawData ) )
		%
		aaiDoorOpeningClosingTransitions(:, 1) = aafRawData( find( aafRawData(:, 1) == tLabels.DOOR_OPEN ), 2 );
		aaiDoorOpeningClosingTransitions(:, 2) = aafRawData( find( aafRawData(:, 1) == tLabels.DOOR_CLOSE ), 2 );
		% 
		aaiLaser1OpeningClosingTransitions(:, 1) = aafRawData( find( aafRawData(:, 1) == tLabels.LASER_1_OPEN ), 2 );
		aaiLaser1OpeningClosingTransitions(:, 2) = aafRawData( find( aafRawData(:, 1) == tLabels.LASER_1_CLOSE ), 2 );
		% 
		aaiLaser2OpeningClosingTransitions(:, 1) = aafRawData( find( aafRawData(:, 1) == tLabels.LASER_2_OPEN ), 2 );
		aaiLaser2OpeningClosingTransitions(:, 2) = aafRawData( find( aafRawData(:, 1) == tLabels.LASER_2_CLOSE ), 2 );
		%
	else%
		%
		aaiDoorOpeningClosingTransitions	= [];
	   	aaiLaser1OpeningClosingTransitions	= [];
	   	aaiLaser2OpeningClosingTransitions	= [];
		%
	end;%	
	%
end % function

